patch from maemo-gtk that changes GtkRange to render its arrows
authorTim Janik <timj@imendio.com>
Wed, 9 Nov 2005 15:32:51 +0000 (15:32 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 9 Nov 2005 15:32:51 +0000 (15:32 +0000)
Wed Nov  9 16:29:42 2005  Tim Janik  <timj@imendio.com>

        * gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
        to render its arrows insensitive when the adjustment is in
        its min or max position. this makes range arrow behaviour
        consistent with spin button behaviour. (#321056)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkrange.c

index ca416ced18f27e2959b9851f9420a0765586f477..0bb79e0545255d658f1631c36fc953ba8ff58ee0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Nov  9 16:29:42 2005  Tim Janik  <timj@imendio.com>
+
+       * gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
+       to render its arrows insensitive when the adjustment is in
+       its min or max position. this makes range arrow behaviour 
+       consistent with spin button behaviour. (#321056)
+
 2005-11-09  Tor Lillqvist  <tml@novell.com>
 
        * gdk/gdkinternals.h
index ca416ced18f27e2959b9851f9420a0765586f477..0bb79e0545255d658f1631c36fc953ba8ff58ee0 100644 (file)
@@ -1,3 +1,10 @@
+Wed Nov  9 16:29:42 2005  Tim Janik  <timj@imendio.com>
+
+       * gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
+       to render its arrows insensitive when the adjustment is in
+       its min or max position. this makes range arrow behaviour 
+       consistent with spin button behaviour. (#321056)
+
 2005-11-09  Tor Lillqvist  <tml@novell.com>
 
        * gdk/gdkinternals.h
index 6330ffe9001cb4fc068268a7929551368f125740..1dc4d4b215bf6e78c97cdf50f02586c6a0c4b9f1 100644 (file)
@@ -919,14 +919,34 @@ draw_stepper (GtkRange     *range,
   gint arrow_width;
   gint arrow_height;
 
+  gboolean arrow_insensitive = FALSE;
+
   /* More to get the right clip region than for efficiency */
   if (!gdk_rectangle_intersect (area, rect, &intersection))
     return;
 
   intersection.x += widget->allocation.x;
   intersection.y += widget->allocation.y;
-  
-  if (!GTK_WIDGET_IS_SENSITIVE (range))
+
+  if (((!range->inverted && (arrow_type == GTK_ARROW_DOWN ||
+                             arrow_type == GTK_ARROW_RIGHT)) ||
+       (range->inverted  && (arrow_type == GTK_ARROW_UP ||
+                             arrow_type == GTK_ARROW_LEFT))) &&
+      range->adjustment->value >=
+      (range->adjustment->upper - range->adjustment->page_size))
+    {
+      arrow_insensitive = TRUE;
+    }
+  else if (((!range->inverted && (arrow_type == GTK_ARROW_UP ||
+                                  arrow_type == GTK_ARROW_LEFT)) ||
+            (range->inverted  && (arrow_type == GTK_ARROW_DOWN ||
+                                  arrow_type == GTK_ARROW_RIGHT))) &&
+           range->adjustment->value <= range->adjustment->lower)
+    {
+      arrow_insensitive = TRUE;
+    }
+
+  if (!GTK_WIDGET_IS_SENSITIVE (range) || arrow_insensitive)
     state_type = GTK_STATE_INSENSITIVE;
   else if (clicked)
     state_type = GTK_STATE_ACTIVE;
@@ -934,8 +954,8 @@ draw_stepper (GtkRange     *range,
     state_type = GTK_STATE_PRELIGHT;
   else 
     state_type = GTK_STATE_NORMAL;
-  
-  if (clicked)
+
+  if (clicked && ! arrow_insensitive)
     shadow_type = GTK_SHADOW_IN;
   else
     shadow_type = GTK_SHADOW_OUT;
@@ -955,7 +975,7 @@ draw_stepper (GtkRange     *range,
   arrow_x = widget->allocation.x + rect->x + (rect->width - arrow_width) / 2;
   arrow_y = widget->allocation.y + rect->y + (rect->height - arrow_height) / 2;
   
-  if (clicked)
+  if (clicked && ! arrow_insensitive)
     {
       gint arrow_displacement_x;
       gint arrow_displacement_y;